<?php
	include("../../include/dbconnect.php");
	extract($_POST);
	$strdk=" where un='$un'";
	$table="account";
	session_start();
	header("Content-Type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
	echo "<account>";
	if($_SESSION["un"]=="")
	{
		echo "<status>fail</status>";
		echo "<count>0</count>";
		echo "<message>Chưa đăng nhập !</message>";
	}
	else 
	{
		$result=mysql_query("select $table.*,(select groups.ten from groups where groups.ma=$table.magrp) as tengroups from $table $strdk",$conn) or die(mysql_error());
		echo "<status>ok</status>";
		echo "<count>",mysql_num_rows($result),"</count>";
		echo "<message>OK</message>";	
		while($a=mysql_fetch_array($result))
		{
			echo "<row id='",$a["un"],"'>";
			echo "<cell>",$a["un"],"</cell>";//0
			echo "<cell><![CDATA[",$a["pwd"],"]]></cell>";//1
			echo "<cell>",$a["magrp"],"</cell>";//2
			echo "<cell>",$a["tengroups"],"</cell>";//3
			echo "</row>";
		}
		mysql_free_result($result);
	}

	echo "</account>";
	include("../../include/dbclose.php");
?>